/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chatsoft.client.buz;

import ChatSoft.model.ChatMessage;
import ChatSoft.model.ConnectChatVoiceMessage;
import ChatSoft.model.FileRequestMessage;
import ChatSoft.model.FileResponseMessage;
import ChatSoft.model.UserData;
import ChatSoft.model.User;
import ChatSoft.model.VoiceRequestMessage;
import ChatSoft.model.VoiceResponseMessage;
import ChatSoft.model.buz.SendObject;
import java.io.ObjectOutputStream;

/**
 *
 * @author KID
 */
public class ChatBussiness{
    
    public ObjectOutputStream outStream;
    private UserData mess;
    
    SendObject sendObject;
    public ChatBussiness(ObjectOutputStream outStream) {
        this.outStream = outStream;
    }
    
    public void sendChatRequest(User user, String frName) { //syc
        mess = new UserData();
        mess.setRequestChatWith(frName);
        mess.setUser(user);
        mess.setCommandName("CheckChatRequest");
        SendObject.sendObject(mess, outStream);
    }
    
    public void sendMessage(ChatMessage chatMess) //syc
    {
        SendObject.sendObject(chatMess, outStream);
    }
    
    public void sendVoiceRequest(
            VoiceRequestMessage request) 
    {
        SendObject.sendObject(request, outStream);
    }
    
    public void sendVoiceResponse(
            VoiceResponseMessage response) 
    {
        SendObject.sendObject(response, outStream);
    }
    
    public void sendFileRequest(
            FileRequestMessage request) 
    {
        SendObject.sendObject(request, outStream);
    }
    
    public void sendFileResponse(
            FileResponseMessage response) 
    {
        SendObject.sendObject(response, outStream);
    }
    
    public void sendConnectChatVoiceMessage(
            ConnectChatVoiceMessage connectVoiceMessage) 
    {
        SendObject.sendObject(connectVoiceMessage, outStream);
    }
}
